# coding:utf-8
from common.DBdata import MYSQL
from common.basepage import pyselenium
from common.yamldata import get_yaml_data
from config import *
from locations.Saas_loc.Saas_loc import *


class Saas_homepages_login(pyselenium):
    # 登录页元素
    def login(self):
        loc = Login
        parm = get_yaml_data(datas_path + r"Saas\登录\登录.yaml")
        self.open(parm["url"])
        self.input(loc.USERNAME, parm["username"])
        self.input(loc.PASSWORD, parm["password"])
        self.click(loc.LOGIN_BTN)


class Saas_monitor_device(pyselenium):
    DB = MYSQL()
    loc_men = Menu
    loc = Monitor

    def Menu_clk(self):
        # 点击菜单
        self.click(self.loc_men.MONITOR)
        self.click(self.loc_men.DEVICES)

    def Add_btn_clk(self):
        # 新增按钮点击
        self.click(self.loc.DEVICES_ADD_BTN)

    def Qrcode_inp(self, text):
        # 输入设备条码
        self.input(self.loc.QRCODE_INP, text)

    def Region_clk(self):
        # 点击监测点
        self.click(self.loc.REGION)
    def Region_par_clk(self):
        # 选择根监测点
        self.click(self.loc.REGION_PARENT)
    # def Region_chil_clk(self):
    #     self.click()

